package com.umakr.ax.app.web;

import java.util.Map;

import com.umakr.ax.app.service.AutoMenuWebService;
import com.umakr.ax.app.vo.AutoMenuSaveVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.ApiOperation;

import com.umakr.ax.core.base.AbstractController;

/**
 * <p>
 * ${table.comment}  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/web/autoMenu")
public class AutoMenuWebController extends AbstractController {

	@Autowired
	AutoMenuWebService autoMenuWebService;

	@ApiOperation(value = "读取自定义菜单")
	@GetMapping(value = "/read/detail")
	public Object get(ModelMap modelMap, @RequestParam Map<String, Object> param) {
		return setSuccessModelMap(modelMap, autoMenuWebService.detail(param));
	}

	@ApiOperation(value = "保存自定义菜单")
	@PostMapping(value = "/saveOrUpdateAutoMenu")
	public Object saveOrUpdateAutoMenu(ModelMap modelMap, AutoMenuSaveVO autoMenuSaveVo) {
		return setSuccessModelMap(modelMap, autoMenuWebService.saveOrUpdateAutoMenu(autoMenuSaveVo));
	}

	@ApiOperation(value = "读取自定义菜单")
	@GetMapping(value = "/getAutoMenuDetail")
	public Object getAutoMenuDetail(ModelMap modelMap, @RequestParam Long rsId) {
		return setSuccessModelMap(modelMap, autoMenuWebService.getAutoMenuDetail(rsId));
	}
}